package cn.itcast.bos.quartz.job;

import java.util.Date;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import cn.itcast.bos.service.PromotionService;
import cn.itcast.bos.service.WayBillService;

public class PromotionJob implements Job{

	@Autowired
	private PromotionService promotionService;
	@Autowired
	private WayBillService wayBillService;
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		//当前时间大于Promotion表的endDate字段的时间，说明该活动已经过去，需要更新status = '2'
		promotionService.updateStatus(new Date());
		// 使用定时器完成数据库和索引库同步
		wayBillService.syncIndex();
	}

}
